home *** CD-ROM | disk | FTP | other *** search
- ;-------------------------schar routine begins--------------------------+
- ; NAME SCHAR
- ;
- ; ROUTINE TO PLOT A STROKE CHARACTER
- ;
- ; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
- ; page : 148
- ;
- ; FUNCTION: This routine plots a stroke character. It uses a stroke
- ; character table in which each character is stored as a series of
- ; strokes. The user must create the stroke character table according
- ; to specific rules. Each stroke is stored as three bytes. The first
- ; byte contains a code as follows:
- ;
- ; 1Ah = end of strokes
- ; 'U' = pen Up; move to new posn but don't draw
- ; 'D' = pen Down; draw a stroke from old to new posn
- ;
- ; The second byte contains the local x-coordinate of the new current
- ; position, and the third byte contains the local y-coordinate of the
- ; new current position. These local coordinates are relative to the
- ; upper left corner of the character cell. At the beginning of the
- ; stroke table is a table of addresses for the locations of the strokes
- ; for each of the characters.
- ;
- ; INPUT: Upon entry:
- ;
- ; ACSII code character is in AL
- ; x-coordinate of upper left corner of character cell is in x0
- ; y-coordinate of upper left corner of character cell is in y0
- ; horizontal magnitude is in xmagn
- ; vertical magnitude is in ymagn
- ; color of character is in color
- ;
- ; OUTPUT: Just to the screen.
- ;
- ; REGISTERS USED: No registers are modified.
- ;
- ; SEGMENTS REFERENCED: Upon entry ES must point to the video RAM at
- ; B8000h and DS must point to the data segment used by the point and
- ; line drawing routines. This data segment must also contain the table
- ; of stroke characters.
- ;
- ; ROUTINES CALLED: SETLINE
- ;
- ; SPECIAL NOTES: No bounds checking is performed. Unpredictable results
- ; will be displayed if the horizontal or vertical magnitude is too large.
- ; A string of raster characters can be displayed using the GMESSOUT
- ; routine available on this disk.
- ;
- ; ROUTINE TO PLOT A STROKE CHARACTER
- ;
- schar proc far
- ;
- push si ; save registers
- push cx
- push ax
- ;
- cbw ; make the ASCII code into 16-bit
- sal ax,1 ; times 2
- mov si,ax ; into the index
- mov si,ptable[si] ; look up the particular character
- mov ax,x0 ; x-coord of upper left char
- mov x2,ax
- mov ax,y0 ; y-coord of upper left corner
- mov y2,ax
- ;
- ; run through the strokes
- newstroke:
- lodsb ; get the code byte
- cmp al,1Ah ; end of strokes ?
- jz scharexit
- mov dl,al ; save code
- ;
- ; update x-coord of current position
- mov ax,x2 ; old x-coord
- mov x1,ax ; gets pushed back
- lodsb ; new x-coord
- mov cl,xmagn ; times xmagn
- mul cl l multiply
- add ax,x0 ; add to upper left corner
- mov x2,ax ; and put into current position
- ;
- ; update y-coordinate of current position
- mov ax,y2 ; old y-coord
- mov y1,ax ; gets pushed back
- lodsb ; new y-coord
- mov cl,ymagn ; times ymagn
- mul cl l multiply
- add ax,y0 ; add to upper left corner
- mov y2,ax ; and put into current position
- ;
- cmp dl,'U' ; pen up ?
- je newstroke ; skip if so
- ;
- call setline ; draw the stroke
- ;
- jmp newstroke ; next stroke
- ;
- scharexit:
- pop ax ; restore registers
- pop cx
- pop si
- ;
- ret ; return
- schar endp
- ;-------------------------schar routine ends---------------------------+